<template>
  <div class="redis-box">
    <span>重置缓存</span>
    <el-button size="mini" type="primary" @click="open">确定</el-button>
  </div>
</template>
<script>
import * as API_SystemSetting from '@/api/systemSetting'
export default {
  name: 'systemSettingsPromotion',
  methods: {
    open() {
      this.$confirm('此操作将重置促销活动缓存，促销数据较多可能存在延迟，是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        API_SystemSetting.redisPromotion().then(res => {
          this.$message({
            type: 'success',
            message: '重置成功!'
          })
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消重置'
        })
      })
    }
  }
}
</script>
<style lang="scss" scoped>
  .redis-box {
    padding: 20px 30px;
    span {
      font-size: 14px;
      color: #606266;
      padding-right: 20px
    }
  }
</style>